package me.luger.project.picc.entity;


import me.luger.core.commom.util.DateUtil;
import me.luger.core.commom.util.StringUtil;
import me.luger.core.dao.nutz.entity.BaseEntity;
import me.luger.core.dao.nutz.entity.NutzTransient;
import org.nutz.dao.entity.annotation.*;
import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.util.Date;

@Table("prizeList")
public class PrizeList extends BaseEntity implements Serializable{
private static final long serialVersionUID=1L;


    /**
     * 自增ID
     */
    @Id
    @Column("id")
    @Comment("自增ID")
    @ColDefine(type = ColType.INT, width = 10)
    private Integer id;
    /**
     * 微信openId
     */
    @Column("openId")
    @Comment("微信openId")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String openId;
    /**
     * 人保保单号
     */
    @Column("pid")
    @Comment("人保保单号")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String pid;
    /**
     * 活动ID
     */
    @Column("typeId")
    @Comment("活动ID")
    @ColDefine(type = ColType.INT, width = 10)
    private Integer typeId;

    /**
     * 用户参加活动后的业务ID
     */
    @Column("bizId")
    @Comment("用户参加活动后的业务ID")
    @ColDefine(type = ColType.INT, width = 10)
    private Integer bizId;
    /**
     * 奖品ID
     0：特等奖
     1~4：n等奖
     999：谢谢参与
     */
    @Column("prizeId")
    @Comment("奖品ID-1：幸运奖0：谢谢参与1~4：n等奖999：特等奖")
    @ColDefine(type = ColType.INT, width = 10)
    private Integer prizeId;

    /**
     * 中奖活动名称
     */
    @Column("typeName")
    @Comment("中奖活动名称")
    @ColDefine(type = ColType.VARCHAR, width = 512)
    private String typeName;
    /**
     * 奖品内容
     */
    @Column("prizeDetail")
    @Comment("奖品内容")
    @ColDefine(type = ColType.VARCHAR, width = 512)
    private String prizeDetail;

    /**
     * 用户是否中奖0：未中奖 1：中奖了
     */
    @Column("prizeResult")
    @Comment("用户是否中奖0：未中奖 1：中奖了")
    @ColDefine(type = ColType.INT, width = 1)
    private Integer prizeResult;

    /**
     * 用户抽奖时间
     */
    @Column("prizeDate")
    @Comment("用户抽奖时间")
    @ColDefine(type = ColType.DATETIME, width = 19)
    @JSONField (format="yyyy-MM-dd HH:mm:ss")
    private Date prizeDate;

    /**
     * 中奖后的秘钥
     */
    @Column("prizeSecrect")
    @Comment("中奖后的秘钥")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String prizeSecrect;
    /**
     * 领奖人手机号
     */
    @Column("phoneNum")
    @Comment("领奖人手机号")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String phoneNum;
    /**
     * 领奖人姓名
     */
    @Column("userName")
    @Comment("领奖人姓名")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String userName;
    /**
     * 领奖人邮编
     */
    @Column("zCode")
    @Comment("领奖人邮编")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String zcode;
    /**
     * 领奖人地址
     */
    @Column("address")
    @Comment("领奖人地址")
    @ColDefine(type = ColType.VARCHAR, width = 255)
    private String address;

    @NutzTransient
    private Integer jiaodu;

    public void setId(Integer id){
        this.id=id;
    }
    public Integer getId(){
        return this.id;
    }

    public void setOpenId(String openId){
        this.openId=openId;
    }
    public String getOpenId(){
        return this.openId;
    }

    public void setPid(String pid){
        this.pid=pid;
    }
    public String getPid(){
        return this.pid;
    }

    public void setTypeId(Integer typeId){
        this.typeId=typeId;
    }
    public Integer getTypeId(){
        return this.typeId;
    }

    public void setPrizeId(Integer prizeId){
        this.prizeId=prizeId;
    }
    public Integer getPrizeId(){
        return this.prizeId;
    }

    public void setPrizeSecrect(String prizeSecrect){
        this.prizeSecrect=prizeSecrect;
    }
    public String getPrizeSecrect(){
        return this.prizeSecrect;
    }

    public void setPhoneNum(String phoneNum){
        this.phoneNum=phoneNum;
    }
    public String getPhoneNum(){
        return this.phoneNum;
    }

    public String getHiddenPhoneNum(){
        if(StringUtil.isBlank(phoneNum) || phoneNum.length() != 11){
            return phoneNum;
        }
        return phoneNum.replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
    }

    public void setUserName(String userName){
        this.userName=userName;
    }
    public String getUserName(){
        return this.userName;
    }

    public void setZcode(String zcode){
        this.zcode=zcode;
    }
    public String getZcode(){
        return this.zcode;
    }

    public void setAddress(String address){
        this.address=address;
    }
    public String getAddress(){
        return this.address;
    }

    public Integer getPrizeResult() {
        return prizeResult;
    }

    public void setPrizeResult(Integer prizeResult) {
        this.prizeResult = prizeResult;
    }

    public String getPrizeDetail() {
        return prizeDetail;
    }

    public void setPrizeDetail(String prizeDetail) {
        this.prizeDetail = prizeDetail;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public Date getPrizeDate() {
        return prizeDate;
    }

    public String getFormatDate(){
        return DateUtil.format(prizeDate,DateUtil.DATE_TIME_YYYY_MM_DD_HH_MM_SS);
    }

    public void setPrizeDate(Date prizeDate) {
        this.prizeDate = prizeDate;
    }

    public Integer getBizId() {
        return bizId;
    }

    public void setBizId(Integer bizId) {
        this.bizId = bizId;
    }

    public Integer getJiaodu() {
        return jiaodu;
    }

    public void setJiaodu(Integer jiaodu) {
        this.jiaodu = jiaodu;
    }
}